package com.alipay.config;
import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2016100100641021";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDa1Ejos5gZwBouCNleioOkFT7w0JFVkxqOrTtod0sylJDRp3UdqT++uuGtF3XLMw8tXMvTWY1ukLOVpZ/phSIlc7ricLCymyXoy6d/8FS8gIX4f2tFPOdc0tAtFwqWdYtX2EtD8vemeaM0zn4uGlcQ43QO6Lwm0cqx6Bh+QwvuRf5RJu/A8SCG/i171UmJX83fcRyYsYuCLt/mbs/D1gNyQL9cVENRBM3Q1XdDpkPYDH5U/VfGD0FKrA8319huVBy3KNzalveu7k0ElKjrO/wBCP3Lr/PFI7w2KRXuulxaPz0MEO8rJTrmBlnxo+98peIbpoHt1AxAwBRjI/8cc17HAgMBAAECggEAYBth1gmiYJTVKqiqRvJQtIy8Mul3Gv1baZQ9hjj2ZsWHAP0p25gMrgjHusyV6GOJY+PghPdMvWWB6dRu8hGNmKNGTdMuV5L6SE7BRthXbt6HeEcF5sfD2SmhUlxPQxtm0nLlQ3d/OrcrbbLPChJ5cKpku3ONxwLWoeIMd8+ces2kdcH+DclZFwD1b3DhwnCh7GWyl7/gSmebx7JpDm3t4e3ZRZV6lqEOkHs78XJZU3YBQ3WjmUSEL+pl9nIzSb5UamXR2CBHA7vVzOJWzpwFTa5DMgn1RcQgDFRcxd38LbeEW/hRoNmMv0DJDJN4BGylNj+yLD/LsU9ijDMK3M2tWQKBgQD8uaXnPQ2BruzhwxzwsPLdBn6dY+Lz1vZIPEdkfb7GeCkYyn6EEw4OREU8/4539EEfpgzmXr++Re07pnz+DmQqD98pd0QXgC8Qbw0SZNYYUOludcEOfgh0Cc1i76LQtrj35h1TlFSZieHK7aXeoElALlNCkQpww1wkODXCBMlApQKBgQDdqjILzJGHV7Kxnj+SXq3Y1UArZJB5tfve2cM6j+BuAvZU2LJfnsVUp48TlE59EBEFtg4vOR0Ik/ZoMLNqEaeMVC3QwcT+wrPNjVrMwwx1qUdV6ZVbBVS0QnuwxVgwCmojJEFz7bxdOUOfiaYiFK66ib9KLZ9H23aHNi9zLdd5+wKBgFLIENLUycbP4KH2wlUI8RR7GyA85stOf2+b5xrAoavrEjMfqR9kCneb3z4iy6z5IhfW0WToZlBSIWonl8u0NRUeC9BOU8yK3V+5sIN06jge0Mew5KL1n5k62L7uldtd7uqswrBs5uVAJ+jLvUhWIohWZElqrwvOwjDPBLTf0nhNAoGAav3odBuErvAcl3ELvEmo3f1ooMlElwrJDPLNMeoaaN9TKPcDefX3x3mtLMUr8V+c58XNKOwHYImSqQ3Au9TTq39CMf4laNZv1SqChk0rKWvQu94oMivri6p/a36Fp4KPYnDwitVYUyL9yfa10sNq5yzvwQ0uUY/TsUXtN0oMNJsCgYEA3ZBRpx2iCBvi/BsnupYrMywkBmJtdJI4CjlRWGLQMDU6by2cOJBm+54EdYcDlxup7v3cbKyjwKnnnrMuhCIaMVTAef4wKaQFGo7Pi8M2ZHuenHS1DxEmtoJgUvupEbzmISJ5EoPgqm3meqSsmE783LCxlS2nF1+znSsBm2U/TJ4=";
	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAhTF9BPlQbAKMgA2ixkq+QjpHFmovBVyxT0rIDmWZZLfS7YnErWuHgZpZlPx4y+BNf+YihJstRj+p6x95+yN0g01T4kV2/+bubsRzq15uLES+3KDsRi5eDYTkdUEYjQ9Av/zlZJmp6qeIOXmKUklmLgsjhar5uc0vHLR3yyrHI1h3zsnQ5pOV1B02CTcbc9NgiN3XafiU6lo9rZvThymID8xmQGldE+ikuzmcLlkg3sGB7w+GtWoVLn1k5Rc9pcHXeQeDf6ftHMu4VHv0tfGrqplPJPt1IxNvEPnLF8jbL8zDXQSXbbu8f9kDwAFH4qkjFVsscs5iDd75IMlHa+HEzwIDAQAB";

	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://localhost:8080/webshop/notify_url.jsp";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://localhost:8080/webshop/return_url.jsp";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";
	
	// 支付宝网关
	public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

